package com.zenika.zenbinding.client.handler;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public abstract class TableBindingHandler implements Handler {

	private List<TableBindingListener> listenerList;

	public TableBindingHandler() {
		this.listenerList = new ArrayList<TableBindingListener>();
	}

	public void fireOnClick(int row, int column) {
		Iterator<TableBindingListener> iter = this.listenerList.iterator();
		while (iter.hasNext()) {
			TableBindingListener listener = iter.next();
			listener.onCellClicked(row, column);
		}
	}

	public void addListBindingListener(TableBindingListener listener) {
		this.listenerList.add(listener);
	}

	public void removeListBindingListener(TableBindingListener listener) {
		this.listenerList.remove(listener);
	}

}
